home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
util
/
arc
/
LZHUtils_src.lha
/
XJoin.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-06-05
|
1KB
|
67 lines
/*
* XJoin - Join several parts of a file to a single one.
*
*
* © 1995 The Xperts Group Inc. All Rights Reserved.
* Author: Manolis S Pappas.
* Version 1.1a
*
*
*/
#include <stdio.h>
#include <string.h>
#define VERSION "1.1a"
#define EXIT_FAILURE 1
static const char versid[]="$VER: XJoin v1.1a (7.1.96)";
FILE *open_vol(name, no)
char *name;
long no;
{
char work[1024];
if (no)
sprintf(work, "%s.%02d", name, no);
else
sprintf(work, "%s", name);
return fopen(work, "rb");
}
int main(argc, argv)
int argc;
char **argv;
{
char buffer[1024]; /* Small I/O buffer */
FILE *in, *out;
long j, vol_no = 0;
if (argc != 3) {
printf("XJoin v%s\n",VERSION);
printf("Copyright (©) 1995-96, The Xperts Group Inc.\n");
printf("All Rights Reserved Worldwide.\n");
printf("Author: Manolis S Pappas.\n\n");
printf("Usage: %s <infilebase> <outfilename>\n", argv[0]);
exit(EXIT_FAILURE);
}
if (out = fopen(argv[2], "wb")) {
while (in = open_vol(argv[1], vol_no++)) {
while(!feof(in)) {
j = fread(buffer, 1, 1024, in);
fwrite(buffer, 1, j, out);
}
fclose(in);
}
} else {
printf("Error opening destination!!\n\n");
exit(EXIT_FAILURE);
}
return 0;
}